<?php require_once(DB_FILE); ?>
<ul class="list-style1">
    <li>
        <img src="images/gold_cup.png" style="width:25px;"><h2>Hall of fame</h2>						
        <table width="100%">
            <?php
                $db = new DBConnection();
            
                $query = "SELECT `nick`,`avatar`,`points`
                            FROM users
                            ORDER BY `points` DESC
                            LIMIT 3";
                if ($db->executeQuery($query)) {
                    $result =  $db->getResult();
                    if($result!= null && $result->num_rows > 0) {
                        $counter = 1;
                        while($row = $result->fetch_assoc()) {
                            //echo '<tr><td><img src="images/medal_' . $counter . 
                            //        '.png" style="width:25px;"></td>';
                            echo '<tr><td style="width:30px;"><img src="images/avatars/' . $row['avatar'] . 
                                    '.png" style="width:30px;"></td>';
                            echo '<td>' . stripslashes($row['nick']) . 
                                    '</td><td>' . $row['points'] . '</td></tr>';
                            $counter ++ ;	
                        }
                    }
                }
            ?>						
        </table>
    </li>
</ul>